package com.lay.config;

import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.ErrorPageRegistrar;
import org.springframework.boot.web.server.ErrorPageRegistry;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;

@Configuration
public class ErrorConfig implements ErrorPageRegistrar {
    @Override
    public void registerErrorPages(ErrorPageRegistry registry) {
        ErrorPage errorPage1 = new ErrorPage(HttpStatus.NOT_FOUND,"/error1");
        ErrorPage errorPage2 = new ErrorPage(HttpStatus.UNAUTHORIZED,"/error1");
        ErrorPage errorPage3 = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR,"/error1");
        registry.addErrorPages(errorPage1,errorPage2,errorPage3);
    }
}
